<template>
    <div>
        <div class="wei-body">
            <div class="header-contain">
                <!-- title -->
                <div class="p0">
                    <div class="p1"></div>
                    <div class="p2">
                        <img src="/static/images/health.png" alt="">
                        <label>健康食材 餐餐都香</label>
                        <img class="img" src="/static/images/health.png" alt="">
                    </div>
                    <div class="p3"></div>
                </div>
            </div>
            <div class="body-contain">
                <div class="child2">
                    <div class="child2-con">
                        <div class="con-div" v-for="(item, index) in discountList" :key="index">
                            <div class="re-xiao"><p>限量</p></div>
                            <img :src="item.dish_images" alt="">
                            <div class="recommend-title">
                                <p class="con-p">{{ item.dish_name }}</p>
                                <div class="recommend-title-child">
                                    <div>
                                        <label>￥</label>
                                    <label class="recommend-num"> {{ item.dish_nprice / 100 }}</label>
                                    </div>
                                    <div class="recommend-img">
                                        <img src="/static/images/add.png" alt="">
                                    </div>
                                </div>
                                <div class="recommend-add">
                                    <p v-if="item.dish_gprice.length > 0">￥ {{ item.dish_gprice / 100 }}</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div v-if="!more" class="contain-footer"><p>我是有底线的 T_T</p></div>
            </div>
        </div>
    </div>
</template>

<script>
import { showModel } from "../util";
export default {
  data() {
        return {
            discount_count: 15,
            more: true,
            discountList: []
        }
    },
    methods: {
        //读取当前菜品
        getFreshDish() {
           /*  wx.showLoading({
                title: '加载中', // 数据请求前loading
                icon: 'loading'
            }) */
            try {
                this.$httpWx.GET({
                url: 'getDiscountPriceList/' + this.discount_count,
                }).then(res => {
                    // wx.hideLoading()
                    this.discountList = res.data
                    this.more = false
                })
            } catch (e) {
                showModel('请求失败', '请检查网络后再试!')
            }
        }
    },
    onLoad() {
        this.getFreshDish()
    },
}
</script>

<style scoped>
.wei-body {
  width: 100%;
}

.header-contain {
    height: 30px;
    width: 100%;
}
.wei-body .p0 {
    display: flex;
    width: 100%;
}
.p1 {
    width: 29%;
    height: 2px;
    border-top: 1px solid rgb(121, 117, 117);
    margin-top: 15px;
    margin-left: 10px;
}
.p2 {
    width: 39%;
    padding-left: 3px;
    font-size: 12px;
    color: rgb(121, 117, 117);
    margin-top: 5px;
}
.p2 label {
    position:absolute;
    padding-top: 3px;
    text-align: center;
}
.p2 img {
    width: 20px;
    height: 20px;
}
.p2 .img {
    float: right;
    padding-right: 3px;
}
.p3 {
    width: 29%;
    height: 2px;
    border-top: 1px solid rgb(121, 117, 117);
    margin-top: 15px;
    margin-right: 10px;
}


.body-contain {
    background: rgb(241, 239, 239);
    width: 100%;
    padding-top: 1px;
    padding-bottom: 10px;
}
.body-contain .child1 {
    height: 195px;
    background: #ffffff;
    margin: 10px 10px 0 10px;
    border-radius: 10px;
}
.child1 .child1-t1 {
    font-size: 15px;
    font-weight: 500;
    padding: 5px 0 0 10px;
    letter-spacing: 3px;
}
.child1 .recommend_scroll_x_box {
  height: 165px;
  white-space: nowrap;
  display: flex;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  color: transparent;
}

.recommend_hot_box {
  width: 110px;
  height: 165px;
  margin: 10px 5px 0 10px;
  display: inline-block;
}

.recommend_hot_image {
  width: 110px;
  height: 75px;
}
.recommend_hot_box .recommend-title p {
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 110px;
}
.recommend-title .recommend-title-child {
    font-size: 12px;
    font-weight: 600;
    margin-top: 14px;
    color: rgb(250, 38, 23);
    display: flex;
}
.recommend-title-child .recommend-num {
    font-size: 18px;
    letter-spacing: 1px;
}
.recommend-title .recommend-add {
    font-size: 13px;
    color:rgb(110, 105, 104);
    font-weight: 500;
    text-decoration: line-through;
}
.recommend-title .recommend-img {
    width: 25px;
    height: 25px;
    margin-left: auto;
}
.recommend-title .recommend-img img {
    width: 100%;
    height: 100%;
}

.body-contain .child2 {
    background: #ffffff;
    margin: 10px 10px 0 10px;
    border-radius: 10px;
    padding-top: 0;
}
.child2-t1 {
    height: 115px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    background: -webkit-linear-gradient(rgb(160, 250, 195),rgb(18, 221, 96));
    background: -o-linear-gradient(rgb(160, 250, 195),rgb(18, 221, 96));
    background: -moz-linear-gradient(rgb(160, 250, 195),rgb(18, 221, 96));
    background:linear-gradient(rgb(160, 250, 195),rgb(18, 221, 96));
}
.t1-left {
    width: 50%;
    margin: 10px 0 0 20px;
}
.child2-p1 {
    font-size: 25px;
    font-weight: 500;
    letter-spacing: 2px;
    color: #fdfdfd;
}
.child2-p2 {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 2px;
    color: #fdfdfd;
}
.child2-p3 {
    width: 60px;
    height: 18px;
    font-size: 11px;
    margin-top: 15px;
    background: #ffffff;
    letter-spacing: 1px;
    border-radius: 10px;
    text-align: center;
    padding-top: 4px;
    color: rgb(18, 221, 96);
}
.t1-right {
    width: 50%;
    margin-top: 15px;
}
.t1-right img {
    width: 150px;
    height: 90px;
    border-radius: 5px;
}

.child2-con {
    display: flex;
    justify-content: left;
    flex-wrap: wrap;
    align-items: center;
}
.child2-con .con-div {
    width: 108px;
    height: 160px;
    margin: 10px 0 0 8px;
}
.con-div .re-xiao {
    position: absolute;
    width: 20px;
    height: 35px;
    background: rgb(253, 81, 13);
    font-size: 12px;
    text-align: center;
    color: #ffffff;
    border-bottom-right-radius: 30px;
    border-bottom-left-radius: 30px;
    letter-spacing: 1px;
    opacity: 0.8;
}
.child2-con img {
    width: 108px;
    height: 73px;
}
.recommend-title .con-p {
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 110px;
}

.con-div1 {
    width: 100%;
}
.child2-con .con-div1 p {
    width: 60px;
    font-size: 14px;
    color: gray;
    margin: 0 auto;
}


.contain-footer {
    width: 300px;
    margin: 10px auto;
}
.contain-footer p {
    width: 280px;
    font-size: 15px;
    color: rgb(172, 167, 167);
    text-align: center;
}
</style>